/*
-------------------------------------------------

	Input.h

	Dmitriy Kuzmenko (Dgut)

-------------------------------------------------
*/

#ifndef __AUTUMN_INPUT_H__
#define __AUTUMN_INPUT_H__

#include "Singleton.h"

namespace Autumn
{

#define gInput Input::GetInstance()

class Input : public Singleton< Input >
{
	static const int		MAX_TOUCHES = 16;
	
	float					prevTouches[ MAX_TOUCHES * 2 ];
	int						numPrevTouches;
	
	float					touches[ MAX_TOUCHES * 2 ];
	int						numTouches;

	bool					prevKeys[ 256 ];
	bool					keys[ 256 ];

							Input( void );
							~Input( void );
public:
	const bool				Init( void );
	void					Shutdown( void );
	void					Frame( void );
	
	void					Save( void );

	void					Touch( const float * points, int numPoints );
	void					Key( int key, bool down );
	
	const float * const		GetTouches( void ) const;
	const int				GetNumTouches( void ) const;

	const bool				GetKey( int key ) const;
	
	const bool				IsDown( float x, float y, float width, float height ) const;
	const bool				IsMove( float x, float y, float width, float height ) const;
	const bool				IsEnter( float x, float y, float width, float height ) const;
	const bool				IsUp( float x, float y, float width, float height ) const;

	const bool				IsDown( void ) const;
	const bool				IsUp( void ) const;
	const bool				IsMove( void ) const;

	const bool				IsKeyDown( int key ) const;
	const bool				IsKeyUp( int key ) const;
		
	friend class			Singleton< Input >;
};
	
}	// namespace Autumn

#endif	// !!! __AUTUMN_INPUT_H__ !!!